import json
from flask import Blueprint, request
from utilsapp import wxnotify_fun

wxnotify = Blueprint('wxnotify', __name__)

with open("./config.json", "r", encoding="utf-8") as f:
    config = json.load(f)
wx_notify_interface = wxnotify_fun.Interface(config)


@wxnotify.route('/getUserOpenId', methods=['POST'])
def wx_open_id():
    code = request.json.get('code')
    datas = wx_notify_interface.getUserOpenId(code)
    return datas
